#pragma once

#include "Node.h"
#include <map>
#include <string>

using namespace std;

namespace Huffman {

	class Tree
	{
	public:
		static Node* ESC;
		static Node* NYT;
		static Node* EOC;

		Tree(void);
		~Tree(void);

		/*Node* addSymbol(char symbol);*/
		Node* findNode(char symbol);
		/*void incrementWeights(Node* node);*/

		void updateTreeVitter(char symbol);
		Node* slideAndIncrement(Node*);
		Node* slideHigherThanLeafNodesWithWeight(Node*, int );
	    Node* slideHigherThanNodesWithWeight(Node*, int );
		void swapNodes(Node*, Node* );		

		void setRoot(Node* n);
		Node* getRoot() const;

	private:		
		Node* slide(Node* currentNode, Node* nextNode);

		std::map<char, Node*> nodeMap;
		Node* root;
		int idCounter;
	};
}
